package com.yzh.dxpro.p11.taskEleven;


import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import java.io.BufferedReader;
import java.io.FileReader;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.yzh.dxpro.p4.utils.TProperties;
public class ElevenMapper extends Mapper<LongWritable,Text,Text,Text>{
	Text okey=new Text();
	Text ovalue=new Text();
	IntWritable one=new IntWritable();
	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context)
			throws IOException, InterruptedException {
		// TODO Auto-generated method stub
		String[] str=value.toString().split(TProperties.getValue("fileoutsplit")) ;
		String path=context.getInputSplit().toString();
		if(path.indexOf("liveout")>=0)
			{
			okey=new Text(str[0]);
			ovalue=new Text("0"+TProperties.getValue("outfilesplit")+str[1]
					+TProperties.getValue("outfilesplit")+str[2]
					+TProperties.getValue("outfilesplit")+str[4]
					+TProperties.getValue("outfilesplit")+str[5]);
			context.write(okey, ovalue);
			}else{
				okey=new Text(str[0]);
				ovalue=new Text("1"+TProperties.getValue("outfilesplit")+str[1]);
				context.write(okey, ovalue);
			}}

}
